<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ include file="/WEB-INF/jsp/business/include/doctype.jsp" %>
<script type="text/javascript">
	function formCheck() {
		if($('#txtTitle').val() == '') {
			alert('제목을 입력해 주세요.');
			return;
		}
		if($('#htmlbody').val() == '') {
			alert('내용을 입력해 주세요.');
			return;
		}
		if (confirm('등록하시겠습니까?')) {
			document.ideaForm.submit();
		}
		return;
	}
	// 심사부서 심사자 존재여부 체크 (화면 로딩 후)
	$().ready(function() {
		msg = '심사부서에 심사자가 지정되지 \n 않았습니다. 제안 담당자에게 문의하세요.';
		$.ajax({
			url: '${requestScope.contextPath}/business/mOI_/mOIJudgeCheck.do',
			type:'POST',
			dataType:'json',
			success: function(json){
				if(json) {
					if (json.result == 'N') {
						alert(msg);
						history.back(-1);
					}
				} else {
					alert(msg);
					history.back(-1);
				}
			},
			error: function(){
				alert(msg);
				history.back(-1);
			}
		});
	});
</script>
</head>
<body>
	<div id="wrap">
		<div class="header">
			<h1>O.I. 제안</h1>
		</div><!-- // header -->
		<div class="content">
			<h3>아이디어 제안</h3>
			<form name="ideaForm" action="${requestScope.contextPath}/business/mOI_/mOIIdeaSuggestionWrite.do" method="post" onsubmit="return false;">
			<div class="table5">
				<input type="hidden" name="JudgeDeptCode" value="${sessionScope.SESSION_USER_INFO.DeptCode}" />
				<table summary="아이디어 등록" cellspacing="0" style="width:100%;">
					<caption>아이디어 등록</caption>
					<colgroup>
						<col style="width:25%" />
						<col style="width:75%" />
						</colgroup>
					<tbody>
						<tr>
							<th scope="row"><label for="name">제안자</label></th>
							<td><input type="text" name="name" id="name" class="intxt3" value="${sessionScope.SESSION_USER_INFO.UserName} ${sessionScope.SESSION_USER_INFO.DeptName}" readonly="readonly" /></td>
						</tr>
						<tr>
							<th scope="row"><label for="JudgeDeptCode">심사부서</label></th>
							<td><input type="text" name="JudgeDeptCode" class="intxt5" id="JudgeDeptCode" value="${sessionScope.SESSION_USER_INFO.DeptName}" readonly="readonly" /></td>
						</tr>
						<tr>
							<th scope="row"><label for="security">보 안</label></th>
							<td align="left"><input type="checkbox" class="intxt5" id="security" name="chkSecurity" value="3" /></td>
						</tr>
						<c:choose>
						<c:when test="${sessionScope.SESSION_USER_INFO.CompanyCD eq 'KIC'}">
						<tr>
							<th scope="row">유형</th>
							<td><input type="radio" name="radiobutton" checked="checked" id="oi" value="1" /><label for="oi">O.I. 제안</label>&nbsp;&nbsp;<input type="radio" name="radiobutton" id="operate" value="2" /><label for="operate">COST제안</label></td>
						</tr>
						</c:when>
						<c:when test="${sessionScope.SESSION_USER_INFO.CompanyCD eq 'KGT'}">
						<tr>
							<th scope="row">유형</th>
							<td><input type="radio" name="radiobutton" checked="checked" id="oi" value="1" /><label for="oi">O.I. 제안</label>&nbsp;&nbsp;<input type="radio" name="radiobutton" id="operate" value="2" /><label for="operate">환경경영</label></td>
						</tr>
						</c:when>
						</c:choose>
						<tr>
							<th scope="row"><label for="txtTitle">제목</label></th>
							<td><input type="text" name="txtTitle" class="intxt3" id="txtTitle" /></td>
						</tr>
						<tr>
							<th scope="row"><label for="htmlbody">제안내용</label></th>
							<td><textarea cols="" rows="8" class="comment" id="htmlbody" name="htmlbody"></textarea></td>
						</tr>
					</tbody>
				</table>
			</div>
			<div class="btn_area2" style="padding-bottom:20px;">
				<p><img src="${requestScope.contextPath}/images/btn/register.gif" alt="등록" onclick="formCheck();" style="cursor: pointer;" />&nbsp;&nbsp;<a href="javascript:history.back(-1);"><img src="${requestScope.contextPath}/images/btn/btn_reset.gif" alt="취소" /></a></p>
			</div>
			</form>
		</div><!-- // content -->
	</div><!-- // wrap -->
</body>
</html>